package com.tledu.zyf.servlet;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@WebServlet("/a/b/c/for")
public class _10_Forward extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		// 发送一条请求,所以对 for 发送的参数,在_06_page.jsp中也可以获取

		// 不加/ 是相对定位,相对当前请求
		// 加 / 是绝对定位,定位到当前项目
		System.out.println(request.getParameter("id"));
		System.out.println(request.getContextPath());
		// TODO 数据查询
		// 因为数据互通,所以当我们需要向页面传递数据的时候,一定是用 forword跳转
		request.setAttribute("data", "xxxxxx");
		request.getRequestDispatcher("/_06_page.jsp").forward(request, response);
		System.out.println("---");
	}
}
